<?php
namespace App\Model\Device;

use App\Model\Base;

class DeviceType extends Base{
	public $tableName = "mymk_device_type";

	/**
	 * 通过条件获取数据库里面的用户
	 * @auth   xiaozhi
	 * @param  array   $condition [description]
	 * @return [type]             [description]
	 */
	public function getDeviceTypeData($condition = [], $columns = '*', $page = 1, $limit =10) {

		if(!empty($limit)) {
			$this->db->pageLimit = $limit;
		}

		if(!empty($condition['id'])) {
			$this->db->where("id", $condition['id']);
		}

		$this->db->orderBy("id", "desc");
		$res = $this->db->paginate($this->tableName, $page, $columns);

		$data = [
			'total_page' => $this->db->totalPages,
			'page_size' => $limit,
			'count' => intval($this->db->totalCount),
			'lists' => $res
		];
		return $data;

	}

}